package com.nbicc.anon.attachments.controller;

import com.nbicc.attachments.service.IAttachmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "附件(匿名)" , description = "附件操作")
@RestController
@RequestMapping(value = "/anon/attachment")
public class AnonAttachmentController {

    @Resource(name = "AttachmentServiceImpl")
    private IAttachmentService attachmentService;

    @ApiOperation(value = "附件下载" , notes = "附件id")
    @GetMapping("/{id}")
    public void downloadFile(
            @PathVariable("id") long id,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        attachmentService.downloadFile(request , response , id);
    }

}
